// ==========================================================================
// GFast自动生成controller操作代码。
// 生成日期：2024-04-24 10:28:09
// 生成路径: internal/app/business/controller/agents.go
// 生成人：周志雄
// desc:代理商
// company:云南奇讯科技有限公司
// ==========================================================================


package controller


import (
    "context"
    "github.com/tiger1103/gfast/v3/api/v1/business"
    "github.com/tiger1103/gfast/v3/internal/app/business/service"    
    systemController "github.com/tiger1103/gfast/v3/internal/app/system/controller"    
)


type agentsController struct {    
    systemController.BaseController    
}


var Agents = new(agentsController)


// List 列表
func (c *agentsController) List(ctx context.Context, req *business.AgentsSearchReq) (res *business.AgentsSearchRes, err error) {
	res, err = service.Agents().List(ctx, req)
	return
}


// Get 获取代理商
func (c *agentsController) Get(ctx context.Context, req *business.AgentsGetReq) (res *business.AgentsGetRes, err error) {
    res = new(business.AgentsGetRes)
	res.AgentsInfoRes,err = service.Agents().GetById(ctx, req.Id)
	return
}


// Add 添加代理商
func (c *agentsController) Add(ctx context.Context, req *business.AgentsAddReq) (res *business.AgentsAddRes, err error) {
	err = service.Agents().Add(ctx, req)
	return
}


// Edit 修改代理商
func (c *agentsController) Edit(ctx context.Context, req *business.AgentsEditReq) (res *business.AgentsEditRes, err error) {
	err = service.Agents().Edit(ctx, req)
	return
}


// Delete 删除代理商
func (c *agentsController) Delete(ctx context.Context, req *business.AgentsDeleteReq) (res *business.AgentsDeleteRes, err error) {
	err = service.Agents().Delete(ctx, req.Ids)
	return
}